<?php
namespace backend\controllers;

use common\models\customer\LyCustomer;
use common\models\customer\LyCustomerReturn;
use Yii;
use yii\base\UnknownMethodException;
use yii\web\HttpException;

/**
 * Test controller
 */
class TestController extends BaseController
{
    /**
     * Displays homepage.
     * 客户状态流转测试
     * @return string
     */
    public function actionCustomerStatus()
    {
        $this->returnJson = true;
        $customer = LyCustomer::findOne(69);
        $customer->newStatus = LyCustomer::STATUS_MASTER_VERIFY;
        $customer->save(false);
        $customer->newStatus = LyCustomer::STATUS_MASTER_REJECT;
        $customer->save(false);
        $customer->newStatus = LyCustomer::STATUS_MASTER_VERIFY;
        $customer->save(false);
        $customer->newStatus = LyCustomer::STATUS_NEED_VERIFY;
        $customer->save(false);
        $customer->newStatus = LyCustomer::STATUS_VERIFY_REJECT;
        $customer->save(false);
        $customer->newStatus = LyCustomer::STATUS_MASTER_VERIFY;
        $customer->save(false);
        $customer->newStatus = LyCustomer::STATUS_NEED_VERIFY;
        $customer->save(false);
        $customer->newStatus = LyCustomer::STATUS_DEP_ASSIGN;
        $customer->save(false);
        return $this->renderJson();
    }

    /**
     * Displays homepage.
     * 退单状态流转测试
     * @return string
     */
    public function actionReturnStatus()
    {
        $this->returnJson = true;
        $customer = new LyCustomerReturn();
        $customer->newStatus = LyCustomerReturn::STATUS_MASTER_VERIFY;
        $customer->customer_id = 2;
        $customer->save(false);
        $customer->currentLog->desc = '理由';
        $customer->currentLog->return_id = $customer->id;
        $customer->currentLog->save();
        $customer->newStatus = LyCustomerReturn::STATUS_MANAGER_VERIFY;
        $customer->save(false);
        $customer->newStatus = LyCustomerReturn::STATUS_FRONTEND_HANDLE;
        $customer->save(false);
        $customer->newStatus = LyCustomerReturn::STATUS_COMPLETE;
        $customer->save(false);
        return $this->renderJson();
    }

    public function actionIndex()
    {
        $a = null;
    }

}
